#include "AM.h"
#include "../hotmacCtp.h"

configuration hotmacCtpC {

}
implementation {
  components hotmacCtpP, MainC, LedsC, ActiveMessageC;
  components CollectionC as Collector;
  components CtpP;
  components new CollectionSenderC(AM_DATA_MSG) as Send;
  components new TimerMilliC() as TxTimer;
  components new TimerMilliC() as SnifferTimer;
  components CC2420ActiveMessageC;
  // components CC2420RadioC;
  // components CC2420CsmaC;
  components CC2420PowerC;
  components TimeSyncMessageC;
  components HilTimerMilliC;
  components RandomC;

  components SerialActiveMessageC;
  components new SerialAMSenderC(AM_DATA_MSG);
  components new QueueC(message_t*, 12);
  components new PoolC(message_t, 12);

  hotmacCtpP.Boot -> MainC;
  hotmacCtpP.RadioControl -> ActiveMessageC;
  // hotmacCtpP.EnergyControl -> CC2420CsmaC;
  hotmacCtpP.EnergyControl -> CC2420PowerC.SplitControl;
  hotmacCtpP.RoutingControl -> Collector;
  hotmacCtpP.RootControl -> Collector;
  hotmacCtpP.CtpInfo -> Collector;
  hotmacCtpP.Send -> Send;
  hotmacCtpP.Intercept -> Collector.Intercept[AM_DATA_MSG];
  hotmacCtpP.Receive -> Collector.Receive[AM_DATA_MSG];

  hotmacCtpP.TxTimer -> TxTimer;
  hotmacCtpP.SnifferTimer -> SnifferTimer;
  hotmacCtpP.RadioPacket -> ActiveMessageC;
  hotmacCtpP.Random -> RandomC;
  hotmacCtpP.Leds -> LedsC;

  hotmacCtpP.SerialControl -> SerialActiveMessageC;
  hotmacCtpP.UARTSend -> SerialAMSenderC.AMSend;
  hotmacCtpP.Queue -> QueueC;
  hotmacCtpP.Pool -> PoolC;

  hotmacCtpP.SnifferSend -> TimeSyncMessageC.TimeSyncAMSendMilli[AM_SNIFFER_MSG];
  hotmacCtpP.LocalTime -> HilTimerMilliC;
  // hotmacCtpP.LplInfo -> CC2420RadioC.LplInterface;
  hotmacCtpP.LinkEstimator -> CtpP;
  // hotmacCtpP.ProbeInfo -> CC2420RadioC.ProbeInterface;
  hotmacCtpP.CC2420Packet -> CC2420ActiveMessageC;
  hotmacCtpP.LowPowerListening -> ActiveMessageC;

  components HotmacC;
  hotmacCtpP.SendInfo -> HotmacC.SendInfo;
  hotmacCtpP.ReceiveInfo -> HotmacC.ReceiveInfo;
}
